module.exports = app => {
  const { router, controller, middleware } = app
  router.get('/', controller.home.index)

  const isadmin = middleware.isadmin()

  router.post('/shops', controller.shop.create)
  router.delete('/shops/:id', isadmin, controller.shop.delete)
  router.put('/shops/:id', isadmin, controller.shop.update)
  router.get('/shops', controller.shop.list)
  router.get('/shops/:id', controller.shop.id)

  router.post('/sellers', controller.seller.create)
  router.delete('/sellers/:id', isadmin, controller.seller.delete)
  router.put('/sellers/:id', isadmin, controller.seller.update)
  router.get('/sellers', controller.seller.list)
  router.get('/sellers/:id', controller.seller.id)

  router.post('/medias', controller.media.create)

  router.post('/user/login', isadmin, controller.user.login)
  // router.get('/brands', controller.brand.list)
  // router.post('/brands', controller.brand.update)
  // router.get('/brands/model/:id', controller.brand.model)

  router.post('/contacts', controller.contact.create)
  router.get('/contacts', isadmin, controller.contact.list)
  router.delete('/contacts/:id', isadmin, controller.contact.delete)

  router.post('/financings', controller.financing.create)
  router.get('/financings', isadmin, controller.financing.list)
  router.get('/financings/:id', isadmin, controller.financing.show)
  router.delete('/financings/:id', isadmin, controller.financing.delete)
}
